<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
		<script type="text/javascript" > 
			window.onload = function(){
				
					//获取元素
					let btn = document.getElementById('btn');
					btn.onclick = function(event){ //处理代码块
						let username = document.getElementById('username');
						username.value = '';
					};
					let username = document.getElementById('username');
					//绑定获取焦点事件处理函数
					username.onfocus = function(){
						username.value = '';
					}
					
					username.onblur = function(){
						username.value = '默认的数据';
					}
					/*   */
			
				
				
			}
		</script>
		
	</head>
	<body >
		
		<input type="text" name="username" id="username" value="默认的数据" />
		
		<button type="button" id="btn"  >清空</button>
		
	
	</body>
</html>
